/*
 * utils.h
 *
 *  Created on: 2019年2月21日
 *      Author: bx-fantx
 */

#ifndef UTILS_UTILS_H_
#define UTILS_UTILS_H_

#include <string>
#include "../global/BxGlobal.h"

#include "../global/ObasicTypes.h"
#include <mutex>

struct DiskInfo
{
    Oint32  totalsize;
    Oint32  freesize;
    Oint32  usedsize;
    Oint32  usedpercent;
};

#define     BX_printf(fmt, ...)               if(1){printf(fmt, ##__VA_ARGS__);}else{}

class Utils {
public:
	Utils();
	virtual ~Utils();
	static std::string intToString(Oint32 number, Oint32 Placeholder = 0);
	static Ouint8 BCC(Ouint8* buf,Ouint32 len);
	static Ouint32 calcCRC32(Ouint8 *data, Ouint32 size);
	static Ouint32 getTimeSpace(Ouint32 old) ;

	static std::recursive_mutex _system_mutex;
    static std::recursive_mutex _usleep_mutex;
    static std::recursive_mutex _led_para_init_mutex;
    static std::recursive_mutex _bri_set_mutex;
    static std::recursive_mutex _spi_mutex;
    static std::recursive_mutex _fpga_multicast_mutex;
    static std::recursive_mutex _c331_bnk_mutex;
    static std::recursive_mutex _file_deal_mutex;
    static std::recursive_mutex _source_init_mutex;
    static std::recursive_mutex _check_nosig_mutex;
    static std::recursive_mutex _source_hdminfo_mutex;
    static std::recursive_mutex _test_signal_mutex;
    static std::recursive_mutex _rcv_lockor_mutex;
};

#endif /* UTILS_UTILS_H_ */
